<?php
namespace Lm\Models;
use Helpers\Main;
//该model废弃，使用common下的model，by qgz 20181220
class XHLmGoodsIn extends basicModel
{
    /**
     *
     * @var integer or string
     * @Primary
     */

    public $iId;
    public $iGoodsId;
    public $sSize;
    public $iInPrice;
    public $tInTime;
    public $iInNum;
    public $iInType;
    public $iInTypeId;
    public $iInUserId;
    public $iInStatus;
    public $sPhoneNum;
    public $sRemark;
    /**
     *
     * @var integer
     * @Column(type="integer", length=4, nullable=true)
     */
    public $bDelete;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $tCreateDate;

    /**
     *
     * @var integer
     * @Column(type="integer", length=20, nullable=true)
     */
    public $iCreateUserId;

    /**
     *
     * @var string
     * @Column(type="string", nullable=true)
     */
    public $tLastModifyDate;

    /**
     *
     * @var integer
     * @Column(type="integer", length=20, nullable=true)
     */
    public $iLastModifyUserId;

    /**
     * Initialize method for model.
     */
    public function initialize()
    {
        $this->setSource("XHLm_GoodsIn");
    }

    /**
     * Returns table name mapped in the model.
     *
     * @return string
     */
    public function getSource()
    {
        return 'XHLm_GoodsIn';
    }

    /**
     * Allows to query a set of records that match the specified conditions
     *
     * @param mixed $parameters
     * @return XHLmGoodsIn[]|XHLmGoodsIn|\Phalcon\Mvc\Model\ResultSetInterface
     */
    public static function find($parameters = null)
    {
        return parent::find($parameters);
    }

    /**
     * Allows to query the first record that match the specified conditions
     *
     * @param mixed $parameters
     * @return XHLmGoodsIn|\Phalcon\Mvc\Model\ResultInterface
     */
    public static function findFirst($parameters = null)
    {
        return parent::findFirst($parameters);
    }
    /**
     * 创建之前检测是否有创建者和修改者
     *
     *
     * create by qgz 20180730
     */
    public function beforeCreate()
    {
        $date                    = date('Y-m-d H:i:s', time());
        $id                      = Main::getLoginUserInfo('userId');
        $this->tCreateDate       = $date;
        $this->iCreateUserId     = $this->iCreateUserId ? : $id;
        $this->tLastModifyDate   = $date;
        $this->iLastModifyUserId = $this->iLastModifyUserId ? : $id;
    }

}
